package com.wuye.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wuye.basic.domain.WyBalcony;
import com.wuye.basic.domain.WyCommunity;
import com.wuye.basic.domain.WyHome;
import com.wuye.basic.domain.WyUnit;


import com.wuye.charge.domain.vo.WyBalconyunithomeVo;
import com.wuye.domain.WyYbType;
import com.wuye.domain.WyYibiao;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 仪表管理Mapper接口
 * 
 * @author jack
 * @date 2024-11-22
 */
@Mapper
public interface WyYibiaoMapper extends BaseMapper<WyYibiao>
{
    /**
     * 查询仪表管理
     * 
     * @param ybId 仪表管理主键
     * @return 仪表管理
     */
    public WyYibiao selectWyYibiaoByYbId(Long ybId);

    /**
     * 查询仪表管理列表
     * 
     * @param wyYibiao 仪表管理
     * @return 仪表管理集合
     */
    public List<WyYibiao> selectWyYibiaoList(WyYibiao wyYibiao);

    /**
     * 新增仪表管理
     * 
     * @param wyYibiao 仪表管理
     * @return 结果
     */
    public int insertWyYibiao(WyYibiao wyYibiao);

    /**
     * 修改仪表管理
     * 
     * @param wyYibiao 仪表管理
     * @return 结果
     */
    public int updateWyYibiao(WyYibiao wyYibiao);

    /**
     * 删除仪表管理
     * 
     * @param ybId 仪表管理主键
     * @return 结果
     */
    public int deleteWyYibiaoByYbId(Long ybId);

    /**
     * 批量删除仪表管理
     * 
     * @param ybIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteWyYibiaoByYbIds(Long[] ybIds);


    @Select("select * from wy_community where communityId=#{communityId}")
    WyCommunity selectByCommunityid(Long communityId);

    @Select("select * from wy_balcony where balconyId=#{balconyId}")
    WyBalcony selectByBalconyId(Long balconyId);


    @Select("select * from wy_unit where unitId=#{unitId}")
    WyUnit selectByUnitId(Long unitId);


    @Select("select * from wy_home where homeId=#{houseId}")
    WyHome selectByHouseId(Long houseId);


    @Select("select * from wy_yb_type where yb_tp_id= #{ybTypeId}")
    WyYbType selectByTypeId(Long ybTypeId);


    @Select("select * from wy_balconyunithome where id=#{balconyunithomeId}")
    WyBalconyunithomeVo selectByMidId(Long balconyunithomeId);


    @Insert("insert into wy_cost_allocation values(null,#{communicate_id},#{balconyUnitHome_id},#{cost_id},'0',0)")
    void insertCostAll(@Param("communicate_id") Long communityIdParam,
                       @Param("balconyUnitHome_id") Long balconyunithomeId,
                       @Param("cost_id") Long costId);


    @Select("select * from wy_yibiao where house_id =#{id}")
    List<WyYibiao> selectByHomeId(Long homeId);
}
